Skip to content

Smart-device refactor: RustPlusApi beta.3 + device-agnostic trigger event#22

Merged
HandyS11 merged 5 commits into
developfrom
feat/smart-device-refactor
Jun 22, 2026
Merged

Smart-device refactor: RustPlusApi beta.3 + device-agnostic trigger event#22
HandyS11 merged 5 commits into
developfrom
feat/smart-device-refactor

Conversation

@HandyS11

Copy link
Copy Markdown
Owner

Summary

A pure refactor — no new user-facing behavior. Smart Switches behave exactly as before; this prepares the ground for the smart-alarm slice to plug in cleanly.

  1. Bump RustPlusApi/RustPlusApi.Fcm2.0.0-beta.3 and adopt the breaking renames (Expose alarm server id + rename OnSmartSwitchTriggered to OnSmartDeviceTriggered RustPlusApi#82, #83, #84):
    • OnSmartSwitchTriggeredOnSmartDeviceTriggered
    • SmartSwitchEventArgSmartDeviceEventArg (inherits SmartDeviceInfo → carries Id + IsActive)
    • SmartSwitchInfo + AlarmInfo → merged SmartDeviceInfo
  2. Device-agnostic trigger path: the EntityChanged broadcast carries no entity type, so the Connections seam's SmartSwitchTriggered (EventHandler<ulong>) becomes SmartDeviceTriggered (EventHandler<SmartDeviceTrigger>) carrying (EntityId, IsActive); the supervisor publishes a new Abstractions SmartDeviceTriggeredEvent(guild, server, entityId, isActive).
  3. Switch relay filters by entity id: SwitchStateRelay consumes SmartDeviceTriggeredEvent filtered via ISwitchStore.ExistsAsync (ignoring ids it doesn't manage). The switch UI module still publishes SwitchStateChangedEvent for user actions (ON/OFF/Strobe/Rename) — clean split: device-triggered = from the game, state-changed = from our UI.

The trigger path now uses the IsActive carried on the beta.3 broadcast arg (no re-read), eliminating a latent race the old code had; the connect-prime path still re-reads via GetSmartDeviceInfoAsync (which also registers the socket's interest).

Why

The generic SmartDeviceTriggeredEvent + ExistsAsync filter lets the upcoming smart-alarm slice add its own relay consumer with zero further Connections changes — alarms work like switches (prime on connect, react to the in-game broadcast; the entity id is the discriminant, since the broadcast has no type).

Scope / safety

  • Blast radius confined to the Connections project (seam + shim + supervisor) plus the Switches relay/hosted-service.
  • No new migration, no schema change, no EF drift.
  • Switch behavior preserved end-to-end (pair → embed → ON/OFF/Strobe/Rename → connect-priming → live updates).

Verification

  • Full suite: 449 tests across 11 assemblies, 0 failures, none dropped.
  • Strict build 0 warnings / 0 errors (-warnaserror); jb ReformatAndReorder clean.
  • No EF drift (no migration added).

🤖 Generated with Claude Code

@HandyS11 HandyS11 merged commit 9bf6c36 into develop Jun 22, 2026
3 checks passed
@HandyS11 HandyS11 deleted the feat/smart-device-refactor branch June 22, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant